
// 自动生成的过滤器JavaScript代码

// 在applyFilters函数中使用：
const filterData = {
        symbols: Array.from(document.getElementById('symbols').selectedOptions).map(option => option.value),
        directions: Array.from(document.getElementById('directions').selectedOptions).map(option => option.value),
        trade_types: Array.from(document.getElementById('trade_types').selectedOptions).map(option => option.value),
        sides: Array.from(document.getElementById('sides').selectedOptions).map(option => option.value),
        sessions: Array.from(document.getElementById('sessions').selectedOptions).map(option => option.value),
        profit_status: Array.from(document.getElementById('profit_status').selectedOptions).map(option => option.value),
        nth_trade_min: document.getElementById('nth_trade_min').value,
        nth_trade_max: document.getElementById('nth_trade_max').value,
        nth_trade: document.getElementById('nth_trade').value,
};

// 在clearFilters函数中使用：
function clearAllFilters() {
    document.getElementById('symbols').selectedIndex = -1;
    document.getElementById('directions').selectedIndex = -1;
    document.getElementById('trade_types').selectedIndex = -1;
    document.getElementById('sides').selectedIndex = -1;
    document.getElementById('sessions').selectedIndex = -1;
    document.getElementById('profit_status').selectedIndex = -1;
    document.getElementById('nth_trade_min').value = '';
    document.getElementById('nth_trade_max').value = '';
    document.getElementById('nth_trade').value = '';
}

// 在showFilterDetails函数中使用：
function generateFilterDetails(filters) {
    const details = [];

    if (filters.symbols && filters.symbols.length > 0) {
        details.push(`品种: ${filters.symbols.join(', ')}`);
    }

    if (filters.directions && filters.directions.length > 0) {
        details.push(`方向: ${filters.directions.join(', ')}`);
    }

    if (filters.trade_types && filters.trade_types.length > 0) {
        details.push(`类型: ${filters.trade_types.join(', ')}`);
    }

    if (filters.sides && filters.sides.length > 0) {
        details.push(`Side: ${filters.sides.join(', ')}`);
    }

    if (filters.sessions && filters.sessions.length > 0) {
        details.push(`时段: ${filters.sessions.join(', ')}`);
    }

    if (filters.profit_status && filters.profit_status.length > 0) {
        details.push(`盈亏状态: ${filters.profit_status.join(', ')}`);
    }

    if (filters.nth_trade_min || filters.nth_trade_max) {
        const rangeText = `${filters.nth_trade_min || '∞'} - ${filters.nth_trade_max || '∞'}`;
        details.push(`当日第几笔: ${rangeText}`);
    }

    if (filters.nth_trade) {
        details.push(`当天第几笔: ${filters.nth_trade}`);
    }
    return details;
}